package com.right.handler;

import com.right.factory.CloudPackage;
import io.netty.channel.ChannelHandler;
import io.netty.handler.logging.LogLevel;
import io.netty.handler.logging.LoggingHandler;

/**********************************************
 * @author pillar
 * @date 2018/6/13
 * 日志处理
 **********************************************/
@ChannelHandler.Sharable
public class LogHandler extends LoggingHandler {

    public LogHandler(LogLevel logLevel) {
        super(logLevel);
    }
    @Override
    protected String formatMessage(String eventName, Object msg) {
        if (msg instanceof CloudPackage) {
           return "连接状态="+eventName;
        } else {
            return super.formatMessage(eventName, msg);
        }
    }

}
